<template>
  <!-- <div>
    <router-link to="/">home</router-link>|
  <router-link to="/about">about</router-link>
  </div> -->
  <h1>电商练习系统</h1>
  <hr>
  <div>
    <router-view></router-view>
  </div>
</template>
<script  setup>
import {ref,onBeforeMount} from "vue"
import { useRouter, useRoute } from 'vue-router'
import axios from './axios'
const router = useRouter()


onBeforeMount(async ()=>{
  try{
    const resp= await axios.get('/isLogin')
  }catch(error){
    router.push({name:'login'})
  }
  

//   fetch("http://localhost:3003/isLogin",{method: 'GET',
// credentials: 'include'})
//   .then(resp=>{
//     if(resp.status=="401"){
//       router.push({name:'login'})
//     }
//   })
})



</script>